import { Player } from "@minecraft/server";
import { Game, GameComponent } from "@sapi-game/main";
import { DimensionIds, EntityTypeIds } from "@sapi-game/utils/vanila-data";
import { PKPreParingState } from "../state";
import { backHub } from "@/base/func";

export class InteractComponet extends GameComponent<PKPreParingState> {
    override onAttach(): void {
        //返回按钮
        this.subscribe(
            Game.events.buttonPush,
            (t) => {
                backHub(t.source as Player);
            },
            {
                loc: [716, -58, 435],
                dimensionId: DimensionIds.Overworld,
                sourceType: EntityTypeIds.Player,
            }
        );
    }
}
